
** Loading data - generated in dofile: data05
use "$data\minwage_data5_estimation_2012_2015.dta", clear
keep if inrange(tline,-24,24) // 49 event-month oberservation window
replace emplyd = emplyd * 100

** Figure A.1: Raw Time Series' of Average Employment, Income, Hours Worked, and Hourly Wages 
preserve
collapse (count) observations = pnr (mean) felt_200_trim (mean) emplyd ///
		 (mean) timeantF12_trim (mean) calc_hrly_wage, by(month)

** (a) Employment Rate		 
two connected emplyd month, color(black) msize(large) graphregion(color(white)) ///
yti("Employment rate (%)") ylabel(20(10)70) xline(60, lcolor(grey)) ///
						   xline(72, lcolor(grey)) xline(84, lcolor(grey)) xline(96, lcolor(grey)) xti("Month") ///
			xlabel(60 "Dec12" 72 "Dec13" ///
				   84 "Dec14" 96 "Dec15" ///
			, angle(90)) xtick(49(1)96) ///
			scale(0.80)
graph export "$out\Apndx_Figure1A_dofile_descrp01.png", width(800) height(600) replace

** (b) Average Monthly Earnings (Conditional on Employment)				
two connected felt_200_trim month, color(black) msize(large) graphregion(color(white)) ///
yti("Average earnings (DKK)") ylabel(0(2000)10000) xline(60, lcolor(grey)) ///
						   xline(72, lcolor(grey)) xline(84, lcolor(grey)) xline(96, lcolor(grey)) xti("Month") ///
			xlabel(60 "Dec12" 72 "Dec13" ///
				   84 "Dec14" 96 "Dec15" ///
			, angle(90)) xtick(49(1)96) ///
			scale(0.80)
graph export "$out\Apndx_Figure1B_dofile_descrp01.png", width(800) height(600) replace	
restore

** Re-loeading data to calculate percentiles 
forval j = 1/2{
preserve
** (d) Quantiles of Hourly Wage (Conditional on Employment)
	if `j' == 1{
		local var calc_hrly_wage
		local l D
		global range (0(25)200, nogrid)
		global label Hourly wage (DKK)
		global e 2	
		global a 150
	}
** (c) Quantiles of Monthly Hours (Conditional on Employment)
	if `j' == 2{
		local var timeantF12_trim
		local l C
		global range (0(25)150, nogrid)
		global label Monthly hours
	}

keep if emplyd == 100 & `var' > 0 // conditional on employment
collapse ///
		(p10) `var'_p10 = `var' (p20) `var'_p20 = `var' ///
		(p30) `var'_p30 = `var' ///
		(p40) `var'_p40 = `var' (p50) `var'_p50 = `var' ///
		(p60) `var'_p60 = `var' (p70) `var'_p70 = `var' ///
		(p80) `var'_p80 = `var' (p90) `var'_p90 = `var' ///	
		, by(month)
 				
two connected  `var'_p10- `var'_p90 month, ///
	color(black gs2 gs3 gs5 gs6 gs7 gs8 gs10 gs12) msymbol(O D T S + X Oh Dh Th) ///
	graphregion(color(white)) ///
	yti("$label") ylabel$range xline(60, lcolor(grey)) ///
						   xline(72, lcolor(grey)) xline(84, lcolor(grey)) xline(96, lcolor(grey)) xti("Month") ///
			xlabel(60 "Dec12" 72 "Dec13" ///
				   84 "Dec14" 96 "Dec15" ///
			, angle(90)) xtick(49(1)96) ///
	legend(label(1 "Ptile10") label(2 "Ptile20") label(3 "Ptile30") ///
		label(4 "Ptile40") label(5 "Ptile50") label(6 "Ptile60") ///
		label(7 "Ptile70") label(8 "Ptile80") label(9 "Ptile90") cols(5) region(lcolor(white))) scale(0.80)  
graph export "$out\Apndx_Figure1`l'_dofile_descrp01.png", width(800) height(600) replace	
restore
}
